<template>
  <el-dialog :title="title" :visible.sync="open" width="50%"  @close="closeForm" append-to-body>
    <el-form ref="form" :model="form"  label-width="80px" label-position="top">
      <el-form-item label="检测项目">
        <span>{{testItemOptionsObj[form.testItem]}}</span>
      </el-form-item>
      <el-form-item label="风险稽核问卷">
        <el-row>
          <el-col :span="6">
            【姓名】 {{form.name}}
          </el-col>
          <el-col :span="6">
            【性别】{{form.sex=='male'?'男':'女'}}
          </el-col>
          <el-col :span="6">
            【年龄】{{form.age}}
          </el-col>
          <el-col :span="6">
            【电话】{{form.phone}}
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="6">
            【婚姻】{{form.maritalStatus =='1'?'已婚':'单身'}}
          </el-col>
          <el-col :span="6">
            【职业】 {{careerObj[form.career]}}
          </el-col>
          <el-col :span="6">
            【身高】 {{form.height + '厘米'}}
          </el-col>
          <el-col :span="6">
            【体重】{{form.weight + '千克'}}
          </el-col>
        </el-row>
        <el-row>
          <el-col>
            【日期】{{form.createTime}}
          </el-col>
        </el-row>
      </el-form-item>
      <el-form-item label="病患情况" v-if="form.diseasesHistoryList && form.diseasesHistoryList.length>0">
        <div v-for="(historyItem,index) in form.diseasesHistoryList">
          {{index+1}}.{{historyItem}}<br>
        </div>
      </el-form-item>
    </el-form>
  </el-dialog>
</template>

<script>
import {   formViewApplyForm } from "@/api/singera/applyForm";

export default {
  name: "formView",
  data(){
    return{
      // 弹出层标题
      title: "肠癌多基因甲基化检测项目申请单",
      // 是否显示弹出层
      open: false,
      // 表单参数
      form: {},
      testItemOptionsObj: {},
      careerObj: {}
    }
  },
  methods: {
    init(params){

      this.testItemOptionsObj = params.testItemOptionsObj
      this.careerObj = params.careerObj
      formViewApplyForm(params.id).then(response => {
        this.open = true
        this.form = response;
      });

    },
    closeForm(){
      this.open = false
      this.$emit('viewFormClose')
    }
  }
}
</script>

<style scoped>
::v-deep .el-dialog__header{
  border-bottom: 1px solid #ddd;
  text-align: center;
}
</style>
